<?php

/**
 * 行情分析
 * @author yu
 */
namespace quote\service;

use common\service\CommonService;
use herosphp\core\Loader;

class QuoteAnalysisService extends CommonService
{

    public function __construct()
    {
        parent::__construct('quoteAnalysis');
    }


    /**
     * 获取行情分析
     * @param $pagesize
     * @param $page
     * @param $conditions
     * @return mixed
     */
    public function getList($pagesize, $page, $conditions)
    {

        $conditions__ = array();

        if ($conditions != '') {

            $conditions__ = array('p' => $conditions);
        }

        $quoteAnalysisModel = Loader::model('quoteAnalysis');

        $managerModel = Loader::model('manager');

        $items = $this->selectData($quoteAnalysisModel, $managerModel, 'manager_id', $conditions__, array($page, $pagesize));

        foreach ($items as $k => $item) {

            $newItems[$k] = $item['p'];
            $newItems[$k]['manager_name'] = $item['f']['username'];
        }

        $result['total'] = $quoteAnalysisModel->count($conditions);

        $result['items'] = $newItems;

        return $result;

    }


}